package group.program.register.password;

import group.program.Controller.RegisterController;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.*;

class length {
    @InjectMocks
    private RegisterController registerController;

    @BeforeEach
    void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    void testValidatePasswordLength_ValidLength() {
        String validPassword = "12345";
        assertNull(registerController.validatePasswordLength(validPassword));
    }

    @Test
    void testValidatePasswordLength_TooShort() {
        String shortPassword = "1234";
        assertEquals("密码长度必须大于等于5位，小于12位", registerController.validatePasswordLength(shortPassword));
    }

    @Test
    void testValidatePasswordLength_TooLong() {
        String longPassword = "123456789000";
        assertEquals("密码长度必须大于等于5位，小于12位", registerController.validatePasswordLength(longPassword));
    }
}
